Skip to content

fix(studio): a sealed resize of a scaled layer keeps its corner on the pointer at rest - #8562

Merged
miguel-heygen merged 5 commits into
mainfrom
fix/sealed-resize-own-scale
Nov 23, 2026
Merged

miguel-heygen merged 5 commits into
mainfrom
fix/sealed-resize-own-scale

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

What

In a sealed preview, resizing a layer that has its own scale now leaves the dragged corner on the pointer when you stop, as an unsealed preview does. Before, it rested up to about a quarter of a pixel off.

Why

#8560 builds the sealed box's corners from the gesture to work out the rounding remainder, but it sized them with Studio's zoom alone. A layer drawn with a GSAP scale is that much bigger on screen, so the remainder came out short by the layer's own scale. On a 1.5x layer the sealed draft rested 0.18 to 0.21 px off the pointer, against 0.01 unsealed. The release path doesn't change that: both modes add the same 0.04 to 0.05 px after release and save the same corrected position.

Related work

Follows #8560, which added the sealed remainder.

How

packages/studio/src/components/editor/resizeDraft.ts: the gesture's corners use the zoom times the layer's own scale (contentScaleX/Y, which the gesture already measures and which is 1 for an unscaled layer), the same size the overlay box is drawn at.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

fails without the fix: packages/studio/src/components/editor/resizeDraft.test.ts, "moves a sealed box by the same rounding remainder an unsealed draft measures", the row for a box drawn 1.5x mostly by its own 3x scale. Without the fix the sealed shift is 0.25 px off the one the unsealed draft measures; with it, within 0.07 px. The row drawn 1.5x by zoom alone passes either way.

With the fix, on a Linux machine: resizeDraft.test.ts, domEditResizeLocal.test.ts and anchoredResizeReleaseShift.test.ts pass three runs in a row (33 tests). The push gate's named and covering files, Studio tsc, Fallow and pre-push are clean.

Bench

Edit-accuracy bench on a Linux machine, the 13 scale resize cases, main at 4f5bfc2 (with #8560) with and without this change, the same bench for both, two runs per mode, the same in both runs. In px:

sealed, main sealed, this change unsealed, main unsealed, this change
tracking, worst case 0.33 0.23 0.19 0.19
the four -after cases at rest after release 0.20 / 0.27 / 0.20 / 0.27 0.11 / 0.20 / 0.11 / 0.20 0.05 / 0.06 / 0.05 / 0.05 0.05 / 0.06 / 0.05 / 0.05
drop, worst case 0.29 0.29 0.29 0.29
reload, worst case 0.30 0.27 0.27 0.27

Still different sealed: the -after cases rest 0.11 to 0.20 px from the pointer against 0.05 unsealed. One sealed run with this change also showed the one-frame jump after release on resize-scale-px-r0-root-z100-on, which this change doesn't touch.

No visible change

Sealed previews are off by default, so nothing changes for anyone yet.

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 86 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (1)

  • seqfastkeys-none-px-r0-root-z100: tracking 193.72, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0.05, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true

@terencecho terencecho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reconstructed sealed corners now use the measured layer scale and edit zoom on each axis. That matches how the gesture derives the layer scale and leaves the zoom-only case intact. The PR description names the regression row that fails without the fix. All 33 focused tests passed locally, and GitHub checks passed or were skipped.

— tai (automated review)

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 75d35bb Nov 23, 2026
125 checks passed
@miguel-heygen
miguel-heygen deleted the fix/sealed-resize-own-scale branch November 23, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants